package xyz.coolcsm.security.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import xyz.coolcsm.security.entity.SysUser;

import java.util.List;
/**
 * @author 什锦
 * @since 2021-06-1
 */
@Mapper
@Repository
public interface SysUserMapper extends BaseMapper<SysUser> {

    @Select("select * from sys_user where username=#{username}")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "roles", column = "id", javaType = List.class,
                    many = @Many(select = "xyz.coolcsm.security.mapper.RoleMapper.findByUid"))
    })
    SysUser selectByName(String userName);

}
